<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -->
<title>Insert title here</title>

<script type="text/javascript" src="${webServer}/resource/js/jquery.min.js"></script>
</head>
<body>
<a href="http://localhost:8080/study/user"><h1>跳转</h1></a>
<div>
	姓名: <input id="name" type="text" value="张三" placeholder="张三"/><br/>
	性别: <select id="sex">
		<option value="male">男</option>
		<option value="female">女</option>
	</select><br/>
	年龄: <input id="age" type="text" value="20" placeholder="20"/>岁<br/>
	<button id="login">提交</button>
</div>
<script>
	$("#login").click(function(){
		var user={
				"name": $("#name").val(),
				"age" : $("#age").val(),
				"sex" : $("#sex").val()
		};
		alert(user.name);
		$.ajax({
			type: 'post',
			url: "${webServer}/login",
			dataType:"json",
			data : user,
			success: function(data){
				alert(data.message);
			},
			error:function(data){  
				alert("出错了！！:"+data.msg); 
			} 
		});
		return false;
	});
</script>

</body>
</html>